package edu.spsu.utils;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import edu.spsu.SPSUActivity;

public final class UIUtils {
	/**
	 * Invoke "home" action, returning to {@link SPSUActivity}.
	 */
	public static void goHome(Context context) {
		final Intent intent = new Intent(context, SPSUActivity.class);
		intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		context.startActivity(intent);
	}

	public static ProgressDialog showProgressDialog(Context context, String title, String mess) {
		
		return ProgressDialog.show(context, title, mess, true, true);
	}

	public static void hideProgressDialog(ProgressDialog progress) {
		if(progress == null || !progress.isShowing()) return;
		else progress.dismiss();
	}
}